﻿using System;
using System.Collections.Generic;
using System.IO;
using Terraria.ModLoader.IO;

namespace Terraria.ModLoader.Default
{
	// Token: 0x02000307 RID: 775
	public class MysteryWorld : ModWorld
	{
		// Token: 0x06001D73 RID: 7539 RVA: 0x00014E20 File Offset: 0x00013020
		public override void Initialize()
		{
			this.data = new List<TagCompound>();
			this.mysteryNPCs = new List<TagCompound>();
			this.mysteryKillCounts = new List<TagCompound>();
		}

		// Token: 0x06001D74 RID: 7540 RVA: 0x00014E43 File Offset: 0x00013043
		public override TagCompound Save()
		{
			TagCompound tagCompound = new TagCompound();
			tagCompound["list"] = this.data;
			tagCompound["mysteryNPCs"] = this.mysteryNPCs;
			tagCompound["mysteryKillCounts"] = this.mysteryKillCounts;
			return tagCompound;
		}

		// Token: 0x06001D75 RID: 7541 RVA: 0x00014E7D File Offset: 0x0001307D
		public override void Load(TagCompound tag)
		{
			WorldIO.LoadModData(tag.GetList<TagCompound>("list"));
			WorldIO.LoadNPCs(tag.GetList<TagCompound>("mysteryNPCs"));
			WorldIO.LoadNPCKillCounts(tag.GetList<TagCompound>("mysteryKillCounts"));
		}

		// Token: 0x06001D76 RID: 7542 RVA: 0x004393DC File Offset: 0x004375DC
		public override void LoadLegacy(BinaryReader reader)
		{
			List<TagCompound> list = new List<TagCompound>();
			int num = (int)reader.ReadUInt16();
			for (int i = 0; i < num; i++)
			{
				List<TagCompound> list2 = list;
				TagCompound tagCompound = new TagCompound();
				tagCompound["mod"] = reader.ReadString();
				tagCompound["name"] = reader.ReadString();
				tagCompound["legacyData"] = reader.ReadBytes((int)reader.ReadUInt16());
				list2.Add(tagCompound);
			}
			TagCompound tagCompound2 = new TagCompound();
			tagCompound2["list"] = list;
			this.Load(tagCompound2);
		}

		// Token: 0x040018FE RID: 6398
		internal IList<TagCompound> data;

		// Token: 0x040018FF RID: 6399
		internal IList<TagCompound> mysteryNPCs;

		// Token: 0x04001900 RID: 6400
		internal IList<TagCompound> mysteryKillCounts;
	}
}
